<template>
	<view class="content">
		<view class="hexiaocontent" v-for="(item, ind) in hexiaos" :key="ind">
			<view class="hexiaotxt">
				<text style="flex: 1;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;o-text-overflow: ellipsis;">核销店铺:{{item.storeName}}</text>
				<text style="flex: 1;">核销券码:{{item.code}}</text>
			</view>
			<view class="hexiaotxt">
				<text style="flex: 1;">核销积分:+<text style="color: #E36C54;">{{item.integral}}</text>积分</text>
				<text style="flex: 1;">核销时间:{{item.createDatetime|formatDate}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import Api from '@/common/api';
	// import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import uniPopupShare from "@/components/uni-popup/uni-popup-share.vue";
	import uniPopup from "@/components/uni-popup/uni-popup.vue"
	import empty from '@/components/empty';
	import {
		formatDate
	} from '@/common/date';
	export default {
		components: {
			// uniLoadMore,
			empty,
			uniPopupShare,
			uniPopup
		},
		data() {
			return {
				hexiaos:[{createDatetime:''}]
			};
		},
		onLoad(options) {
			this.getHexiaoDetail()
		},
		filters: {},
		onShow() {
		},
		computed: {
			...mapState(['hasLogin', 'userInfo'])
		},
		filters: {
			formatDate(time){
				if (time == null || time === '') {
					return '';
				}
				let date = new Date(time);
				return formatDate(date, 'yyyy/MM/dd hh:mm');
			}
		},
		methods: {
			async getHexiaoDetail(){
				let data = await Api.apiCall('get', Api.integral.listHexiaoDetail, {type:0});
				if(data){
					console.log(data)
					this.hexiaos = data
				}
			},
			dateFormat(time) {
				if (time == null || time === '') {
					return 'N/A';
				}
				let date = new Date(time);
				return formatDate(date, 'yyyy-MM-dd HH:ss');
			}
		}
	};
</script>

<style lang="scss">
	page,
	.content {
		background: #f8f8f8;
		height: 100%;
		padding-top: 8rpx;
		padding-right: 10rpx;
		padding-left: 10rpx;
	}
	
	.hexiaocontent{
		height:100rpx;
		width: 98%;
		background-color: #ffffff;
		border-radius: 15rpx;
		box-shadow: 0 0 10px #e6e6e6;
		padding: 10rpx;
		margin-bottom: 10rpx;
	}
	
	.hexiaotxt{
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #515151;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		-o-text-overflow: ellipsis;
		display: flex;
		letter-spacing: 1rpx;
	}

</style>
